package com.fitns.user.mapper.baseConfig;

import static org.mybatis.dynamic.sql.SqlBuilder.*;

import com.fitns.user.model.baseConfig.TbVehicleOil;

import java.util.List;
import javax.annotation.Generated;

import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.SelectKey;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;
import org.mybatis.dynamic.sql.SqlBuilder;
import org.mybatis.dynamic.sql.delete.DeleteDSL;
import org.mybatis.dynamic.sql.delete.MyBatis3DeleteModelAdapter;
import org.mybatis.dynamic.sql.delete.render.DeleteStatementProvider;
import org.mybatis.dynamic.sql.insert.render.InsertStatementProvider;
import org.mybatis.dynamic.sql.render.RenderingStrategy;
import org.mybatis.dynamic.sql.select.MyBatis3SelectModelAdapter;
import org.mybatis.dynamic.sql.select.QueryExpressionDSL;
import org.mybatis.dynamic.sql.select.SelectDSL;
import org.mybatis.dynamic.sql.select.render.SelectStatementProvider;
import org.mybatis.dynamic.sql.update.MyBatis3UpdateModelAdapter;
import org.mybatis.dynamic.sql.update.UpdateDSL;
import org.mybatis.dynamic.sql.update.render.UpdateStatementProvider;
import org.mybatis.dynamic.sql.util.SqlProviderAdapter;

@Mapper
public interface TbVehicleOilMapper {
    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    @SelectProvider(type=SqlProviderAdapter.class, method="select")
    long count(SelectStatementProvider selectStatement);

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    @DeleteProvider(type=SqlProviderAdapter.class, method="delete")
    int delete(DeleteStatementProvider deleteStatement);

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    @InsertProvider(type=SqlProviderAdapter.class, method="insert")
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="record.id", before=false, resultType=Long.class)
    int insert(InsertStatementProvider<TbVehicleOil> insertStatement);

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    @SelectProvider(type=SqlProviderAdapter.class, method="select")
    @ResultMap("TbVehicleOilResult")
    TbVehicleOil selectOne(SelectStatementProvider selectStatement);

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    @SelectProvider(type=SqlProviderAdapter.class, method="select")
    @Results(id="TbVehicleOilResult", value = {
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="plate_num", property="plateNum", jdbcType=JdbcType.VARCHAR),
        @Result(column="organ_id", property="organId", jdbcType=JdbcType.BIGINT),
        @Result(column="sensor_distance", property="sensorDistance", jdbcType=JdbcType.REAL),
        @Result(column="gps_distance", property="gpsDistance", jdbcType=JdbcType.REAL),
        @Result(column="work_time", property="workTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="add_oil", property="addOil", jdbcType=JdbcType.REAL),
        @Result(column="use_oil", property="useOil", jdbcType=JdbcType.REAL),
        @Result(column="speed", property="speed", jdbcType=JdbcType.REAL),
        @Result(column="oil", property="oil", jdbcType=JdbcType.REAL),
        @Result(column="work_status", property="workStatus", jdbcType=JdbcType.VARCHAR),
        @Result(column="lgitude", property="lgitude", jdbcType=JdbcType.VARCHAR),
        @Result(column="latitude", property="latitude", jdbcType=JdbcType.VARCHAR),
        @Result(column="input_time", property="inputTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="remark", property="remark", jdbcType=JdbcType.VARCHAR)
    })
    List<TbVehicleOil> selectMany(SelectStatementProvider selectStatement);

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    @UpdateProvider(type=SqlProviderAdapter.class, method="update")
    int update(UpdateStatementProvider updateStatement);

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default QueryExpressionDSL<MyBatis3SelectModelAdapter<Long>> countByExample() {
        return SelectDSL.selectWithMapper(this::count, SqlBuilder.count())
                .from(TbVehicleOilDynamicSqlSupport.tbVehicleOil);
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default DeleteDSL<MyBatis3DeleteModelAdapter<Integer>> deleteByExample() {
        return DeleteDSL.deleteFromWithMapper(this::delete, TbVehicleOilDynamicSqlSupport.tbVehicleOil);
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default int deleteByPrimaryKey(Long id_) {
        return DeleteDSL.deleteFromWithMapper(this::delete, TbVehicleOilDynamicSqlSupport.tbVehicleOil)
                .where(TbVehicleOilDynamicSqlSupport.id, isEqualTo(id_))
                .build()
                .execute();
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default int insert(TbVehicleOil record) {
        return insert(SqlBuilder.insert(record)
                .into(TbVehicleOilDynamicSqlSupport.tbVehicleOil)
                .map(TbVehicleOilDynamicSqlSupport.plateNum).toProperty("plateNum")
                .map(TbVehicleOilDynamicSqlSupport.organId).toProperty("organId")
                .map(TbVehicleOilDynamicSqlSupport.sensorDistance).toProperty("sensorDistance")
                .map(TbVehicleOilDynamicSqlSupport.gpsDistance).toProperty("gpsDistance")
                .map(TbVehicleOilDynamicSqlSupport.workTime).toProperty("workTime")
                .map(TbVehicleOilDynamicSqlSupport.addOil).toProperty("addOil")
                .map(TbVehicleOilDynamicSqlSupport.useOil).toProperty("useOil")
                .map(TbVehicleOilDynamicSqlSupport.speed).toProperty("speed")
                .map(TbVehicleOilDynamicSqlSupport.oil).toProperty("oil")
                .map(TbVehicleOilDynamicSqlSupport.workStatus).toProperty("workStatus")
                .map(TbVehicleOilDynamicSqlSupport.lgitude).toProperty("lgitude")
                .map(TbVehicleOilDynamicSqlSupport.latitude).toProperty("latitude")
                .map(TbVehicleOilDynamicSqlSupport.inputTime).toProperty("inputTime")
                .map(TbVehicleOilDynamicSqlSupport.remark).toProperty("remark")
                .build()
                .render(RenderingStrategy.MYBATIS3));
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default int insertSelective(TbVehicleOil record) {
        return insert(SqlBuilder.insert(record)
                .into(TbVehicleOilDynamicSqlSupport.tbVehicleOil)
                .map(TbVehicleOilDynamicSqlSupport.plateNum).toPropertyWhenPresent("plateNum", record::getPlateNum)
                .map(TbVehicleOilDynamicSqlSupport.organId).toPropertyWhenPresent("organId", record::getOrganId)
                .map(TbVehicleOilDynamicSqlSupport.sensorDistance).toPropertyWhenPresent("sensorDistance", record::getSensorDistance)
                .map(TbVehicleOilDynamicSqlSupport.gpsDistance).toPropertyWhenPresent("gpsDistance", record::getGpsDistance)
                .map(TbVehicleOilDynamicSqlSupport.workTime).toPropertyWhenPresent("workTime", record::getWorkTime)
                .map(TbVehicleOilDynamicSqlSupport.addOil).toPropertyWhenPresent("addOil", record::getAddOil)
                .map(TbVehicleOilDynamicSqlSupport.useOil).toPropertyWhenPresent("useOil", record::getUseOil)
                .map(TbVehicleOilDynamicSqlSupport.speed).toPropertyWhenPresent("speed", record::getSpeed)
                .map(TbVehicleOilDynamicSqlSupport.oil).toPropertyWhenPresent("oil", record::getOil)
                .map(TbVehicleOilDynamicSqlSupport.workStatus).toPropertyWhenPresent("workStatus", record::getWorkStatus)
                .map(TbVehicleOilDynamicSqlSupport.lgitude).toPropertyWhenPresent("lgitude", record::getLgitude)
                .map(TbVehicleOilDynamicSqlSupport.latitude).toPropertyWhenPresent("latitude", record::getLatitude)
                .map(TbVehicleOilDynamicSqlSupport.inputTime).toPropertyWhenPresent("inputTime", record::getInputTime)
                .map(TbVehicleOilDynamicSqlSupport.remark).toPropertyWhenPresent("remark", record::getRemark)
                .build()
                .render(RenderingStrategy.MYBATIS3));
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default QueryExpressionDSL<MyBatis3SelectModelAdapter<List<TbVehicleOil>>> selectByExample() {
        return SelectDSL.selectWithMapper(this::selectMany, TbVehicleOilDynamicSqlSupport.id, TbVehicleOilDynamicSqlSupport.plateNum, TbVehicleOilDynamicSqlSupport.organId, TbVehicleOilDynamicSqlSupport.sensorDistance, TbVehicleOilDynamicSqlSupport.gpsDistance, TbVehicleOilDynamicSqlSupport.workTime, TbVehicleOilDynamicSqlSupport.addOil, TbVehicleOilDynamicSqlSupport.useOil, TbVehicleOilDynamicSqlSupport.speed, TbVehicleOilDynamicSqlSupport.oil, TbVehicleOilDynamicSqlSupport.workStatus, TbVehicleOilDynamicSqlSupport.lgitude, TbVehicleOilDynamicSqlSupport.latitude, TbVehicleOilDynamicSqlSupport.inputTime, TbVehicleOilDynamicSqlSupport.remark)
                .from(TbVehicleOilDynamicSqlSupport.tbVehicleOil);
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default QueryExpressionDSL<MyBatis3SelectModelAdapter<List<TbVehicleOil>>> selectDistinctByExample() {
        return SelectDSL.selectDistinctWithMapper(this::selectMany, TbVehicleOilDynamicSqlSupport.id, TbVehicleOilDynamicSqlSupport.plateNum, TbVehicleOilDynamicSqlSupport.organId, TbVehicleOilDynamicSqlSupport.sensorDistance, TbVehicleOilDynamicSqlSupport.gpsDistance, TbVehicleOilDynamicSqlSupport.workTime, TbVehicleOilDynamicSqlSupport.addOil, TbVehicleOilDynamicSqlSupport.useOil, TbVehicleOilDynamicSqlSupport.speed, TbVehicleOilDynamicSqlSupport.oil, TbVehicleOilDynamicSqlSupport.workStatus, TbVehicleOilDynamicSqlSupport.lgitude, TbVehicleOilDynamicSqlSupport.latitude, TbVehicleOilDynamicSqlSupport.inputTime, TbVehicleOilDynamicSqlSupport.remark)
                .from(TbVehicleOilDynamicSqlSupport.tbVehicleOil);
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default TbVehicleOil selectByPrimaryKey(Long id_) {
        return SelectDSL.selectWithMapper(this::selectOne, TbVehicleOilDynamicSqlSupport.id, TbVehicleOilDynamicSqlSupport.plateNum, TbVehicleOilDynamicSqlSupport.organId, TbVehicleOilDynamicSqlSupport.sensorDistance, TbVehicleOilDynamicSqlSupport.gpsDistance, TbVehicleOilDynamicSqlSupport.workTime, TbVehicleOilDynamicSqlSupport.addOil, TbVehicleOilDynamicSqlSupport.useOil, TbVehicleOilDynamicSqlSupport.speed, TbVehicleOilDynamicSqlSupport.oil, TbVehicleOilDynamicSqlSupport.workStatus, TbVehicleOilDynamicSqlSupport.lgitude, TbVehicleOilDynamicSqlSupport.latitude, TbVehicleOilDynamicSqlSupport.inputTime, TbVehicleOilDynamicSqlSupport.remark)
                .from(TbVehicleOilDynamicSqlSupport.tbVehicleOil)
                .where(TbVehicleOilDynamicSqlSupport.id, isEqualTo(id_))
                .build()
                .execute();
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default UpdateDSL<MyBatis3UpdateModelAdapter<Integer>> updateByExample(TbVehicleOil record) {
        return UpdateDSL.updateWithMapper(this::update, TbVehicleOilDynamicSqlSupport.tbVehicleOil)
                .set(TbVehicleOilDynamicSqlSupport.plateNum).equalTo(record::getPlateNum)
                .set(TbVehicleOilDynamicSqlSupport.organId).equalTo(record::getOrganId)
                .set(TbVehicleOilDynamicSqlSupport.sensorDistance).equalTo(record::getSensorDistance)
                .set(TbVehicleOilDynamicSqlSupport.gpsDistance).equalTo(record::getGpsDistance)
                .set(TbVehicleOilDynamicSqlSupport.workTime).equalTo(record::getWorkTime)
                .set(TbVehicleOilDynamicSqlSupport.addOil).equalTo(record::getAddOil)
                .set(TbVehicleOilDynamicSqlSupport.useOil).equalTo(record::getUseOil)
                .set(TbVehicleOilDynamicSqlSupport.speed).equalTo(record::getSpeed)
                .set(TbVehicleOilDynamicSqlSupport.oil).equalTo(record::getOil)
                .set(TbVehicleOilDynamicSqlSupport.workStatus).equalTo(record::getWorkStatus)
                .set(TbVehicleOilDynamicSqlSupport.lgitude).equalTo(record::getLgitude)
                .set(TbVehicleOilDynamicSqlSupport.latitude).equalTo(record::getLatitude)
                .set(TbVehicleOilDynamicSqlSupport.inputTime).equalTo(record::getInputTime)
                .set(TbVehicleOilDynamicSqlSupport.remark).equalTo(record::getRemark);
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default UpdateDSL<MyBatis3UpdateModelAdapter<Integer>> updateByExampleSelective(TbVehicleOil record) {
        return UpdateDSL.updateWithMapper(this::update, TbVehicleOilDynamicSqlSupport.tbVehicleOil)
                .set(TbVehicleOilDynamicSqlSupport.plateNum).equalToWhenPresent(record::getPlateNum)
                .set(TbVehicleOilDynamicSqlSupport.organId).equalToWhenPresent(record::getOrganId)
                .set(TbVehicleOilDynamicSqlSupport.sensorDistance).equalToWhenPresent(record::getSensorDistance)
                .set(TbVehicleOilDynamicSqlSupport.gpsDistance).equalToWhenPresent(record::getGpsDistance)
                .set(TbVehicleOilDynamicSqlSupport.workTime).equalToWhenPresent(record::getWorkTime)
                .set(TbVehicleOilDynamicSqlSupport.addOil).equalToWhenPresent(record::getAddOil)
                .set(TbVehicleOilDynamicSqlSupport.useOil).equalToWhenPresent(record::getUseOil)
                .set(TbVehicleOilDynamicSqlSupport.speed).equalToWhenPresent(record::getSpeed)
                .set(TbVehicleOilDynamicSqlSupport.oil).equalToWhenPresent(record::getOil)
                .set(TbVehicleOilDynamicSqlSupport.workStatus).equalToWhenPresent(record::getWorkStatus)
                .set(TbVehicleOilDynamicSqlSupport.lgitude).equalToWhenPresent(record::getLgitude)
                .set(TbVehicleOilDynamicSqlSupport.latitude).equalToWhenPresent(record::getLatitude)
                .set(TbVehicleOilDynamicSqlSupport.inputTime).equalToWhenPresent(record::getInputTime)
                .set(TbVehicleOilDynamicSqlSupport.remark).equalToWhenPresent(record::getRemark);
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default int updateByPrimaryKey(TbVehicleOil record) {
        return UpdateDSL.updateWithMapper(this::update, TbVehicleOilDynamicSqlSupport.tbVehicleOil)
                .set(TbVehicleOilDynamicSqlSupport.plateNum).equalTo(record::getPlateNum)
                .set(TbVehicleOilDynamicSqlSupport.organId).equalTo(record::getOrganId)
                .set(TbVehicleOilDynamicSqlSupport.sensorDistance).equalTo(record::getSensorDistance)
                .set(TbVehicleOilDynamicSqlSupport.gpsDistance).equalTo(record::getGpsDistance)
                .set(TbVehicleOilDynamicSqlSupport.workTime).equalTo(record::getWorkTime)
                .set(TbVehicleOilDynamicSqlSupport.addOil).equalTo(record::getAddOil)
                .set(TbVehicleOilDynamicSqlSupport.useOil).equalTo(record::getUseOil)
                .set(TbVehicleOilDynamicSqlSupport.speed).equalTo(record::getSpeed)
                .set(TbVehicleOilDynamicSqlSupport.oil).equalTo(record::getOil)
                .set(TbVehicleOilDynamicSqlSupport.workStatus).equalTo(record::getWorkStatus)
                .set(TbVehicleOilDynamicSqlSupport.lgitude).equalTo(record::getLgitude)
                .set(TbVehicleOilDynamicSqlSupport.latitude).equalTo(record::getLatitude)
                .set(TbVehicleOilDynamicSqlSupport.inputTime).equalTo(record::getInputTime)
                .set(TbVehicleOilDynamicSqlSupport.remark).equalTo(record::getRemark)
                .where(TbVehicleOilDynamicSqlSupport.id, isEqualTo(record::getId))
                .build()
                .execute();
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default int updateByPrimaryKeySelective(TbVehicleOil record) {
        return UpdateDSL.updateWithMapper(this::update, TbVehicleOilDynamicSqlSupport.tbVehicleOil)
                .set(TbVehicleOilDynamicSqlSupport.plateNum).equalToWhenPresent(record::getPlateNum)
                .set(TbVehicleOilDynamicSqlSupport.organId).equalToWhenPresent(record::getOrganId)
                .set(TbVehicleOilDynamicSqlSupport.sensorDistance).equalToWhenPresent(record::getSensorDistance)
                .set(TbVehicleOilDynamicSqlSupport.gpsDistance).equalToWhenPresent(record::getGpsDistance)
                .set(TbVehicleOilDynamicSqlSupport.workTime).equalToWhenPresent(record::getWorkTime)
                .set(TbVehicleOilDynamicSqlSupport.addOil).equalToWhenPresent(record::getAddOil)
                .set(TbVehicleOilDynamicSqlSupport.useOil).equalToWhenPresent(record::getUseOil)
                .set(TbVehicleOilDynamicSqlSupport.speed).equalToWhenPresent(record::getSpeed)
                .set(TbVehicleOilDynamicSqlSupport.oil).equalToWhenPresent(record::getOil)
                .set(TbVehicleOilDynamicSqlSupport.workStatus).equalToWhenPresent(record::getWorkStatus)
                .set(TbVehicleOilDynamicSqlSupport.lgitude).equalToWhenPresent(record::getLgitude)
                .set(TbVehicleOilDynamicSqlSupport.latitude).equalToWhenPresent(record::getLatitude)
                .set(TbVehicleOilDynamicSqlSupport.inputTime).equalToWhenPresent(record::getInputTime)
                .set(TbVehicleOilDynamicSqlSupport.remark).equalToWhenPresent(record::getRemark)
                .where(TbVehicleOilDynamicSqlSupport.id, isEqualTo(record::getId))
                .build()
                .execute();
    }
}